package com.yxw.live_vod_boot.service.impl;



import lombok.extern.slf4j.Slf4j;
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yxw.yxnet_cd_center.common.utils.BaseResult;
import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.hutool.core.util.ObjectUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yxw.live_vod_boot.entity.YxLiveShopPunishEntity;
import com.yxw.live_vod_boot.dto.YxLiveShopPunishDTO;
import com.yxw.live_vod_facade.dto.YxLiveShopPunishQueryDTO;
import com.yxw.live_vod_boot.mapper.YxLiveShopPunishMapper;
import com.yxw.live_vod_boot.service.IYxLiveShopPunishService;



    /*** 
    *@author Jiaxu.Huang
    *@date 2023/12/4 16:42:33
    *@update 2023/12/4 16:42:33
    **/
@Slf4j
@Service
//public class YxLiveShopPunishServiceImpl  extends ServiceImpl<YxLiveShopPunishMapper, YxLiveShopPunishEntity> implements IYxLiveShopPunishService{
public class YxLiveShopPunishServiceImpl  implements IYxLiveShopPunishService{
    @Autowired
    private YxLiveShopPunishMapper oYxLiveShopPunishMapper;
    /*** 
    * 保存
    * @param oYxLiveShopPunishDTO
    * @return BaseResult
    
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BaseResult insertYxLiveShopPunish(YxLiveShopPunishDTO oYxLiveShopPunishDTO)
    {
        oYxLiveShopPunishDTO.setId(null);
        YxLiveShopPunishEntity oYxLiveShopPunishEntity = new YxLiveShopPunishEntity();
        BeanUtil.copyProperties(oYxLiveShopPunishDTO, oYxLiveShopPunishEntity);
        oYxLiveShopPunishMapper.insert(oYxLiveShopPunishEntity);
        //oYxLiveShopPunishDTO.setPunishId(oYxLiveShopPunishEntity.getPunishId());
        return BaseResult.success(oYxLiveShopPunishEntity);
    }**/
    /*** 
    * 修改
    * @param oYxLiveShopPunishDTO
    * @return BaseResult
    
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BaseResult updateYxLiveShopPunishById(YxLiveShopPunishDTO oYxLiveShopPunishDTO)
    {
        YxLiveShopPunishEntity oYxLiveShopPunishEntity = new YxLiveShopPunishEntity();
        BeanUtil.copyProperties(oYxLiveShopPunishDTO, oYxLiveShopPunishEntity);
        oYxLiveShopPunishMapper.updateById(oYxLiveShopPunishEntity);
        return BaseResult.success();
    }**/
    /*** 
    * 删除
    * @param id
    * @return BaseResult
    
    @Override
    @Transactional(rollbackFor = Exception.class)
    public BaseResult deleteYxLiveShopPunishById(Long id)
    {
        if(ObjectUtil.isEmpty(id))
        {
            return BaseResult.failed("Id不能为空值");
        }
        oYxLiveShopPunishMapper.deleteById(id);
        return BaseResult.success();
    }**/
    /*** 
    * 根据id查找
    * @param id
    * @return YxLiveShopPunishEntity
    **/
    @Override
    public YxLiveShopPunishEntity selectYxLiveShopPunishById(Long id)
    {
        if(ObjectUtil.isEmpty(id))
        {
            return null;
        }
        return oYxLiveShopPunishMapper.selectById(id);
    }
    /*** 
    * 自定义查询
    * @param oYxLiveShopPunishDTO
    * @return List<YxLiveShopPunishEntity>
    **/
    @Override
    public List<YxLiveShopPunishEntity> selectYxLiveShopPunishList(YxLiveShopPunishQueryDTO oYxLiveShopPunishDTO)
    {
        YxLiveShopPunishEntity oYxLiveShopPunishEntity = new YxLiveShopPunishEntity();
        BeanUtil.copyProperties(oYxLiveShopPunishDTO, oYxLiveShopPunishEntity);
        QueryWrapper<YxLiveShopPunishEntity> oYxLiveShopPunishQueryWrapper = new QueryWrapper();
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getId()),"punish_id",oYxLiveShopPunishEntity.getId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getLiveShopId()),"live_shop_id",oYxLiveShopPunishEntity.getLiveShopId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getShopId()),"shop_id",oYxLiveShopPunishEntity.getShopId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getShopName()),"shop_name",oYxLiveShopPunishEntity.getShopName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getLiveId()),"live_id",oYxLiveShopPunishEntity.getLiveId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getMerchantId()),"merchant_id",oYxLiveShopPunishEntity.getMerchantId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getMerchantName()),"merchant_name",oYxLiveShopPunishEntity.getMerchantName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getViolationId()),"violation_id",oYxLiveShopPunishEntity.getViolationId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getViolationReson()),"violation_reson",oYxLiveShopPunishEntity.getViolationReson());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishType()),"punish_type",oYxLiveShopPunishEntity.getPunishType());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishTimeStart()),"punish_time_start",oYxLiveShopPunishEntity.getPunishTimeStart());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishTimeEnd()),"punish_time_end",oYxLiveShopPunishEntity.getPunishTimeEnd());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishQuantity()),"punish_quantity",oYxLiveShopPunishEntity.getPunishQuantity());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishUnit()),"punish_unit",oYxLiveShopPunishEntity.getPunishUnit());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateUserId()),"create_user_id",oYxLiveShopPunishEntity.getCreateUserId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateUserName()),"create_user_name",oYxLiveShopPunishEntity.getCreateUserName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateTime()),"create_time",oYxLiveShopPunishEntity.getCreateTime());
        //List<YxLiveShopPunishEntity> oListYxLiveShopPunish = oYxLiveShopPunishMapper.selectList(oYxLiveShopPunishQueryWrapper);
        //return Res.ok(oListYxLiveShopPunish);
        return  oYxLiveShopPunishMapper.selectList(oYxLiveShopPunishQueryWrapper);
    }
    /*** 
    * 自定义统计
    * @param oYxLiveShopPunishEntity
    * @return Integer
    **/
    @Override
    public Integer selectYxLiveShopPunishCount(YxLiveShopPunishQueryDTO oYxLiveShopPunishDTO)
    {
        YxLiveShopPunishEntity oYxLiveShopPunishEntity = new YxLiveShopPunishEntity();
        BeanUtil.copyProperties(oYxLiveShopPunishDTO, oYxLiveShopPunishEntity);
        QueryWrapper<YxLiveShopPunishEntity> oYxLiveShopPunishQueryWrapper = new QueryWrapper();
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getId()),"punish_id",oYxLiveShopPunishEntity.getId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getLiveShopId()),"live_shop_id",oYxLiveShopPunishEntity.getLiveShopId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getShopId()),"shop_id",oYxLiveShopPunishEntity.getShopId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getShopName()),"shop_name",oYxLiveShopPunishEntity.getShopName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getLiveId()),"live_id",oYxLiveShopPunishEntity.getLiveId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getMerchantId()),"merchant_id",oYxLiveShopPunishEntity.getMerchantId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getMerchantName()),"merchant_name",oYxLiveShopPunishEntity.getMerchantName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getViolationId()),"violation_id",oYxLiveShopPunishEntity.getViolationId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getViolationReson()),"violation_reson",oYxLiveShopPunishEntity.getViolationReson());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishType()),"punish_type",oYxLiveShopPunishEntity.getPunishType());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishTimeStart()),"punish_time_start",oYxLiveShopPunishEntity.getPunishTimeStart());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishTimeEnd()),"punish_time_end",oYxLiveShopPunishEntity.getPunishTimeEnd());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishQuantity()),"punish_quantity",oYxLiveShopPunishEntity.getPunishQuantity());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishUnit()),"punish_unit",oYxLiveShopPunishEntity.getPunishUnit());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateUserId()),"create_user_id",oYxLiveShopPunishEntity.getCreateUserId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateUserName()),"create_user_name",oYxLiveShopPunishEntity.getCreateUserName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateTime()),"create_time",oYxLiveShopPunishEntity.getCreateTime());
        return oYxLiveShopPunishMapper.selectCount(oYxLiveShopPunishQueryWrapper);
    }
    /*** 
    * 自定义分页查询
    * @param currentPage 当前页
    * @param pageSize 分页大小
    * @param oYxLiveShopPunishEntity
    * @return Page
    **/
    @Override
    public Page selectYxLiveShopPunishPage(YxLiveShopPunishQueryDTO oYxLiveShopPunishDTO)
    {
        YxLiveShopPunishEntity oYxLiveShopPunishEntity = new YxLiveShopPunishEntity();
        BeanUtil.copyProperties(oYxLiveShopPunishDTO, oYxLiveShopPunishEntity);
        Page<YxLiveShopPunishEntity> pageParams = new Page<>(oYxLiveShopPunishDTO.getCurrPage(),oYxLiveShopPunishDTO.getPageSize());
        QueryWrapper<YxLiveShopPunishEntity> oYxLiveShopPunishQueryWrapper = new QueryWrapper();
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getId()),"punish_id",oYxLiveShopPunishEntity.getId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getLiveShopId()),"live_shop_id",oYxLiveShopPunishEntity.getLiveShopId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getShopId()),"shop_id",oYxLiveShopPunishEntity.getShopId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getShopName()),"shop_name",oYxLiveShopPunishEntity.getShopName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getLiveId()),"live_id",oYxLiveShopPunishEntity.getLiveId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getMerchantId()),"merchant_id",oYxLiveShopPunishEntity.getMerchantId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getMerchantName()),"merchant_name",oYxLiveShopPunishEntity.getMerchantName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getViolationId()),"violation_id",oYxLiveShopPunishEntity.getViolationId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getViolationReson()),"violation_reson",oYxLiveShopPunishEntity.getViolationReson());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishType()),"punish_type",oYxLiveShopPunishEntity.getPunishType());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishTimeStart()),"punish_time_start",oYxLiveShopPunishEntity.getPunishTimeStart());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishTimeEnd()),"punish_time_end",oYxLiveShopPunishEntity.getPunishTimeEnd());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishQuantity()),"punish_quantity",oYxLiveShopPunishEntity.getPunishQuantity());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getPunishUnit()),"punish_unit",oYxLiveShopPunishEntity.getPunishUnit());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateUserId()),"create_user_id",oYxLiveShopPunishEntity.getCreateUserId());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateUserName()),"create_user_name",oYxLiveShopPunishEntity.getCreateUserName());
        oYxLiveShopPunishQueryWrapper.eq(ObjectUtil.isNotEmpty(oYxLiveShopPunishEntity.getCreateTime()),"create_time",oYxLiveShopPunishEntity.getCreateTime());
        return oYxLiveShopPunishMapper.selectPage(pageParams, oYxLiveShopPunishQueryWrapper);
    }
}
    

